import { useState, useEffect } from 'react';
import { getDraftPermission } from '../commonServices';
export const useDraft = (props: { processId: any; tabKey: any; isNewVersionDesigner: boolean; }) => {
  const { processId, tabKey, isNewVersionDesigner } = props;
  const [showDraft, $showDraft] = useState(false);

  useEffect(() => {
    if (!isNewVersionDesigner) {
      if (tabKey == '4' || tabKey == '1') {
        getDraftPermission({ processId: processId }).then((res) => {
          $showDraft(res);
        });
      }
    }
  }, [processId, isNewVersionDesigner]);

  return showDraft;
};
